/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades.Revision;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Roggers
 */
@Entity
@Table(name = "editor")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Editor.findAll", query = "SELECT e FROM Editor e"),
    @NamedQuery(name = "Editor.findByIdEditor", query = "SELECT e FROM Editor e WHERE e.idEditor = :idEditor"),
    @NamedQuery(name = "Editor.findByArticulo", query = "SELECT e FROM Editor e WHERE e.articulo = :articulo")})
public class Editor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IdEditor", nullable = false)
    private Integer idEditor;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "Articulo", nullable = false, length = 50)
    private String articulo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEditor")
    private Collection<Informeformato> informeformatoCollection;

    public Editor() {
    }

    public Editor(Integer idEditor) {
        this.idEditor = idEditor;
    }

    public Editor(Integer idEditor, String articulo) {
        this.idEditor = idEditor;
        this.articulo = articulo;
    }

    public Integer getIdEditor() {
        return idEditor;
    }

    public void setIdEditor(Integer idEditor) {
        this.idEditor = idEditor;
    }

    public String getArticulo() {
        return articulo;
    }

    public void setArticulo(String articulo) {
        this.articulo = articulo;
    }

    @XmlTransient
    public Collection<Informeformato> getInformeformatoCollection() {
        return informeformatoCollection;
    }

    public void setInformeformatoCollection(Collection<Informeformato> informeformatoCollection) {
        this.informeformatoCollection = informeformatoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEditor != null ? idEditor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Editor)) {
            return false;
        }
        Editor other = (Editor) object;
        if ((this.idEditor == null && other.idEditor != null) || (this.idEditor != null && !this.idEditor.equals(other.idEditor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Revision.Editor[ idEditor=" + idEditor + " ]";
    }
    
}
